/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.dao.impl;

import vip.dexian.admin.dao.RoleDepartmentDao;
import vip.dexian.admin.entity.RoleDepartment;
import vip.dexian.core.base.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;

/**
 * 角色->部门DaoImpl
 *
 * @author 挺好的 2023年06月08日 11:04:58
 */
@Repository ("roleDepartmentDaoImpl")
public class RoleDepartmentDaoImpl extends BaseDaoImpl <RoleDepartment, Long> implements RoleDepartmentDao {

    /**
     * 根据role id 删除
     *
     * @param roleId
     *         角色id
     *
     * @return 删除成功的数量
     */
    @Override
    public int deleteByRoleId (Long roleId) {
        String jqpl = "DELETE FROM RoleDepartment r WHERE r.roleId=:roleId";

        return this.entityManager.createQuery(jqpl).setParameter("roleId", roleId).executeUpdate();
    }
}

